<?php
    include "../proses/konek.php";
    session_start();
    if(!isset($_SESSION['username'])) {
?>
    <script language="javascript">
        alert('anda blm login');
        document.location='../'
    </script>
<?php
    } else {
        $username = $_SESSION['username'];
        $status = $_SESSION['status'];
    }
$simpan2=mysql_query("SELECT * FROM  $status where email = '$username'");
$hasil2=mysql_fetch_array($simpan2);
    require_once('../render.php');
    $render = new render;

?>
<html>
    <head>
        <meta charset="utf-8">
        <?php $render->icon();?>
        <link rel="stylesheet" type="text/css" href="../css/sidebar.css">
        <link href="../css/jquery.fancybox.css" rel="stylesheet">
        <!-- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700" /> -->
        <script type="text/javascript" src="../css/tinymce/tinymce.min.js"></script>
        <!-- The main CSS file -->
        <link rel="stylesheet" href="../css/bootstrap/css/bootstrap.css">
        <link rel="stylesheet" href="../css/bootstrap/css/bootstrap.min.css">
        <link rel="stylesheet" href="../css/bootstrap/css/profile.css" >
    <!-- CSS to style the file input field as button and adjust the Bootstrap progress bars -->
        <link rel="stylesheet" href="../css/bootstrap/css/bootstrap-theme.min.css">

<?php	
    require_once('../render.php');
    $render=new render;
    $render->icon();
    $render->navigasi();
    $render->profile($status, $username);
?>
        <title></title>
    </head>
    <body>
    <div id="wrapper">
        <div id="sidebar-wrapper">
<?php
    include ('menuslide.php');
    $menu = new menu;
    $menu->init($username, $status);
?>
        </div>
        <div id="page-content-wrapper">
            <div class="container-fluid">
                <div class="row" style="margin-top:20px">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" id="subcontent">
                        <h3>PROFILE</h3>
                        <div class="">
<?php
    if($status=='siswa') {
        $sql=mysql_query("select * from siswa where email_sis='$username'");
        siswa($sql);
    } else {
        $sql=mysql_query("select * from guru where email='$username'");
        guru($sql);
    }

    function guru($data) {
        $cek=mysql_fetch_array($data);
?>
                            <form class='form-horizontal'  action='../proses/update.php' method='post' enctype='multipart/form-data'>
                                <div class="form-group">
                                    <div class="col-sm-12" style="margin-left:180px">
                                        <a class="story-img" href="viewprofile.php?e=<?php echo $list['author']?>"><img src="<?php echo $cek['img'] ?>" style="width:100px;height:100px" class="img-circle"></a>		
                                    </div>
                                </div>
                                <div class="form-group" style="margin-left:170px"> 
                                    <input id="icon" name="image" type="text" value="<?php echo $cek['img']?>">
                                    <a href="javascript:open_popup('../plugin/filemanager/dialog.php?type=2&popup=1&field_id=icon')" class="btn iframe-btn btn-success" type="button" name="select1">select</a>    
                                </div>
                                <div class='form-group'>
                                    <label class='col-sm-2 control-label'>Nama Depan</label>
                                    <div class='col-sm-9'>
                                        <input class='form-control' type='text' name='firstname' value="<?php echo $cek['first_name']?>" >
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <label class='col-sm-2 control-label'>Nama Belakang</label>
                                    <div class='col-sm-9'>
                                        <input class='form-control' type='text' name='lastname' value="<?php echo $cek['last_name']?>">
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <label class='col-sm-2 control-label'>Tanggal Lahir</label>
                                    <div class='col-sm-9'>
                                        <input class='form-control' type='text' name='ttl' value="<?php echo $cek['ttl']?>">
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <label class='col-sm-2 control-label'>Mata Pelajaran</label>
                                    <div class='col-sm-9'>
                                        <input class='form-control' type='text' name='mapel' value="<?php echo $cek['mapel'] ?>">
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <label class='col-sm-2 control-label'>Email</label>
                                    <div class='col-sm-9'>
                                        <input class='form-control' type='text' name='email' value="<?php echo $cek['email'] ?>">
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <label class='col-sm-2 control-label'>Password</label>
                                    <div class='col-sm-9'>
                                        <button class='btn btn-warning' type='button' name='pswd' data-toggle="modal" href="#pss">Change</button>
        <!--
                                        <input class='form-control' type='password' name='password' value="<?php // echo $cek['pass'-]?>">
        -->
                                    </div>
                                </div>
                                <div class='form-group'>
                                    <div class='col-sm-offset-2 col-sm-10'>
                                        <button class='btn btn-primary' type='submit' name='save' id='save'>Submit</button>
                                    </div>
                                </div>
                            </form>
                        </div>
<?php
    }

    function siswa($data) {
        $cek = mysql_fetch_assoc($data);
?>
                        <form class='form-horizontal'  action='../proses/update.php' method='post' enctype='multipart/form-data' name='form1' id='form1'>
                            <div class='form-group'>
                                <div class='col-sm-12' style='margin-left:180px'>
                                    <a class='story-img'><img src="<?php echo $cek['img'] ?>" style='width:100px;height:100px' class='img-circle'></a>
                                </div>
                            </div>
                            <div class='form-group' style='margin-left:170px'> 
                                <input id='icon' name='image' type='text' value="<?php echo $cek['img'] ?>">
                                <a href="javascript:open_popup('../plugin/filemanager/dialog.php?type=1&popup=1&field_id=icon')" class='btn iframe-btn btn-success' type='button' name='select1'>select</a>    
                            </div>
                            <div class='form-group'>
                                <label class='col-sm-2 control-label'>Nama Depan</label>
                                <div class='col-sm-9'>
                                    <input class='form-control' type='text' name='firstname' value="<?php echo $cek['first_nm'] ?>" >
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class='col-sm-2 control-label'>Nama Belakang</label>
                                <div class='col-sm-9'>
                                    <input class='form-control' type='text' name='lastname' value="<?php echo $cek['last_nm'] ?>">
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class='col-sm-2 control-label'>Tanggal Lahir</label>
                                <div class='col-sm-9'>
                                    <input class='form-control' type='text' name='kls' value="<?php echo $cek['kls'] ?>">
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class='col-sm-2 control-label'>Email</label>
                                <div class='col-sm-9'>
                                    <input class='form-control' type='text' name='email' value="<?php echo $cek['email_sis'] ?>">
                                </div>
                            </div>
                            <div class='form-group'>
                                <label class='col-sm-2 control-label'>Password</label>
                                <div class='col-sm-9'>
                                    <button class='btn btn-warning' type='button' name='pswd' data-toggle="modal" href="#pss">Change</button>
    <!--
                                    <input class='form-control' type='password' name='password' value="<?php // echo $cek['pass_sis'] ?>">
    -->
                                </div>
                            </div>
                            <div class='form-group'>
                                <div class='col-sm-offset-2 col-sm-10'>
                                    <button class='btn btn-primary' type='submit' name='save' id='save'>Save</button>
                                </div>
                            </div>
                        <br>
                        <br>
                        <br>
                        </form>
                    </div>
<?php 
    }
?>
                </div>
            </div>
        </div>
    </div>
<?php
    include "changepass.php";
    $passchange = new changepass;
?>
<?php
    $render->footer();
?>
<!-- JQuery Core -->
        <script src="../js/search.js"></script>
        <script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script>		
        <script type="text/javascript" src="../css/bootstrap/js/bootstrap.js"></script>
        <!-- Custom Sidebar Javascript--> 
        <script type="text/javascript" src="../js/sidebar.js"></script>
        <!-- Custom Javascript Load Page-->
        <script type="text/javascript" src="../js/metisMenu.min.js"></script>
        <script src="../js/sb-admin-2.js"></script>
        <script src="../js/jquery.fancybox.pack.js"></script>
        <script type="text/javascript">
            function open_popup(url) {
                var w = 880;
                var h = 600;
                var l = Math.floor((screen.width-w)/2);
                var t = Math.floor((screen.height-h)/2);
                var win = window.open(url, 'ResponsiveFilemanager', "scrollbars=1,width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
            }
        </script>	
    </body>
</html>
<!-- //placehold.it/100 -->
	
